<html>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"/>
<head>
    <style>
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
}

.container {
    width: 100%;
    max-width: 200px; /* 针对大屏幕的最大宽度 */
    margin: 0 auto;
    padding: 20px;
}

/* 针对手机屏幕的媒体查询 */
@media (max-width: 100px) {
    .container {
        padding: 10px; /* 减少内边距以适应小屏幕 */
    }
    /* 其他元素的响应式样式 */
    h1 {
        font-size: 24px; /* 减小标题字体大小 */
    }
    p {
        font-size: 16px; /* 减小段落字体大小 */
    }
    /* 可以根据需要添加更多样式 */
}
.btn {
    width: 100px;
    height: 50px;
    transform: translate(50%, 0%);
    display: block;
    marginleft: auto;
    marginright: auto;
}
    </style>
</head>
<body>
    <br>
    <br>
<button type="button" class="btn" onclick="dc()">随机点菜</button>
<br>
<pre class="custom" style="border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;margin-top: 10px;margin-bottom: 10px;margin-left: 0px;margin-right: 0px;padding-top: 0px;padding-bottom: 0px;padding-left: 0px;padding-right: 0px"><span style="display: block; width: 100%; margin-bottom: -7px; border-radius: 5px; background-color: rgb(40, 44, 52)"></span><code class="hljs" style="overflow-x: auto; padding: 15px 16px 16px; color: rgb(171, 178, 191); border-radius: 5px; display: -webkit-box; background-color: rgb(40, 44, 52)"><span class="hljs-tag"><span id='con'></span></code></pre>
<script type="text/javascript">
var hc={"尖椒回锅":14,"青椒回锅":14,"莲白回锅":14,"豆干回锅":14,"洋葱回锅":14,"竹笋肉片":14,"莴笋回锅":14,"家常豆腐":14,"芹菜肉丝":14,"尖椒肉丝":14,"青椒肉丝":14,"莲白肉丝":14,"豆干肉丝":14,"洋葱肉丝":14,"莴笋肉丝":14,"韭黄肉丝":14,"木耳肉丝":14,"杏鲍菇肉丝":14,"酸菜肉丝":14,"莴笋木耳肉丝":14,"肉沫豆腐":14,"酸菜回锅":14,"肉沫芹菜":14,"莴笋木耳肉片":14,"土豆肉丝":14,"鱼香肉丝":14,"肉沫豇豆":14,"尖椒肉片":14,"青椒肉片":14,"木耳肉片":14,"莴笋肉片":14,"杏鲍菇肉片":14,"平菇肉片":14,"黄瓜肉片":14,"丝瓜肉片":14,"泡椒肉丝":14,"木耳回锅":14,"蒜苔肉丝":15,"蒜苗回锅":15,"蒜苔回锅":15,"香菇肉片":15,"肉沫茄子":15,"四季豆炒肉":16,"土豆片回锅":16,"甜椒回锅":16,"大葱回锅":16,"甜椒肉片":16,"甜椒肉丝":16,"宫保鸡丁":16,"大葱肉片":16,"小炒肉":16,"花菜回锅":16,"盐煎肉":17,"仔姜肉片":17,"仔姜肉丝":17,"双椒肉丝":17,"红烧茄饼":18,"花菜炒腊肉":18,"蒜苔腊肉":18,"鱼香茄饼":18,"青椒猪头肉":18,"尖椒猪头肉":18,"尖椒香肠":18,"蒜苗香肠":18,"青椒香肠":18,"尖椒腊肉":18}

var sc={"酸辣土豆丝":10,"青椒土豆丝":10,"炝炒莲白":10,"清炒黄瓜":10,"蒜泥生菜":10,"炝炒油麦菜":10,"清炒藕片":10,"炝炒小白菜":10,"酸辣大白菜":10,"麻婆豆腐":10,"清炒丝瓜":10,"洋葱蛋饼":12,"酸辣鸭血":10,"苦瓜烘蛋":12,"炒油菜尖":12,"葱花蛋饼":12,"空心菜":12,"青椒蛋饼":12,"炒时蔬":12,"西红柿炒蛋":12,"炒花菜":12,"韭黄炒蛋":12,"煎豆腐":12,"苕尖":12,"干煸苦瓜":13,"尖椒炒蛋":12,"虎皮尖椒":13,"红烧茄子":12,"虎皮青椒":13,"鱼香茄子":12,"干煸四季豆":13,"青椒鸡蛋":12,"麻辣藕丁":14}

function getrnd(num){
    return Math.floor(Math.random()*(num-1+1))+1;
}

function getname(data,num){
    i=0;
    for (var d in data) {
        i=i+1;
        if(i==num){
            return {"name":d,"price":data[d]};
        }
    }
    return -1;
}

function cp(text){
    const textarea = document.createElement("textarea");
    textarea.value = text;
    textarea.style.position = "absolute";
    textarea.style.opacity = "0";
    document.body.appendChild(textarea);
    textarea.select();
    document.execCommand("copy");
    document.body.removeChild(textarea);
}

function dc(){
    var c1=getrnd(66);
    var c2=getrnd(66);
    var c3=getrnd(33);
    var res=getname(hc,c1).name + "," + getname(hc,c2).name + "," + getname(sc,c3).name;
    var je=getname(hc,c1).price + getname(hc,c2).price + getname(sc,c3).price + 9;
    
    document.getElementById("con").innerHTML=res + "<br>合计金额:" + je + ";  4人，人均消费:" + je/4 + "元。";
    cp(res);
    alert("内容已复制到粘贴板！");
}
</script>
</body>
</html>